
let isProcEnv = (process.env.RUN_MODULE === 'proc')    //运行环境：dev|proc
console.log('inspur-ipman module : ' + (isProcEnv ? 'proc' : 'dev'))

module.exports = {
   isProcEnv,
   listenPort : 3000,                       //监听端口

   //mongodb 配置
   mongo: {
      url: isProcEnv ? 'mongodb://localhost:27017/job' :  'mongodb://localhost:27017/job',
      options: {
         connectTimeoutMS: 5000,
         socketTimeoutMS: 5000,
      }
   },

   //需扫描的ip段
   ipPart: ['100.7.43.0', '100.7.46.0'],
   //ip扫描方式:file | shell
   ipScan: 'file',
   //ip结果目录
   ipStatusPath: isProcEnv ? '/opt/install/static/ip_status' : 'data',
   //扫描间隔
   ipScanCycle: 10 * 60 * 1000,

   //日志配置
   log4js : isProcEnv ? {    //生产环境
      appenders : {
         app: {
            type: 'file',
            filename: 'logs/app.log',
            maxLogSize: 10240000,
            backups: 30,
         }
      },
      categories: {
         default: {
            appenders: ['app'],
            level: 'INFO'
         }
      },
      pm2: true
   } : {    //开发环境
      appenders : {
         app: {
            type: 'file',
            filename: 'logs/app.log',
            maxLogSize: 1024000000,
            backups: 30,
         },
         console: { type: 'console' }
      },
      categories: {
         default: {
            appenders: ['app', 'console'],
            level: 'DEBUG'
         }
      }
   }
};